package com.mec.web.y2013.headfirstservlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebInitParam;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.mec.beans.y2012.coreservlet.DBInfoBean;
import com.mec.web.y2013.WebXMLConfig2013;

/**
 * Servlet implementation class Ch5JdbcConfigListenerTester
 */
@WebServlet(urlPatterns = {"/2013/03_Mar/head_first_servlets/Ch5JdbcConfig.test"},
		initParams = {@WebInitParam(name = "jspDest", 
			value = "/WEB-INF/2013/jsp/03_Mar/hfs/Ch5_JdbcConfInfo.jsp")
		}
		)
public class Ch5JdbcConfigListenerTester extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public Ch5JdbcConfigListenerTester() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		//DBInfoBean dbInfo = (DBInfoBean) getServletContext().getAttribute(WebXMLConfig2013.APP_ATTR_DB_INFO);
		String destJsp = getInitParameter("jspDest");
		request.getRequestDispatcher(destJsp).forward(request, response);
		
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doGet(request, response);
	}

}
